package com.dailycodebuffer.springbootmongodb.controller;


import com.dailycodebuffer.springbootmongodb.collection.Employee;
import com.dailycodebuffer.springbootmongodb.service.EmployeeService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;


/**
 * 控制层
 *
 * @author makejava
 * @since 2025-01-04 00:23:42
 */
@RestController
@RequestMapping("/employee")
@AllArgsConstructor
public class EmployeeController {

	private EmployeeService employeeService;

	/**
	 * 获取列表(分页)
	 */
	@GetMapping("/list")
	public Page<Employee> list(Pageable page) {
		return null;
	}

	/**
	 * 获取
	 */
	@GetMapping("/{id}}")
	public Employee get(@PathVariable  Integer id) {
		return employeeService.findById(id);
	}

	/**
	 * 添加
	 */
	@PostMapping("/add")
	public void add(@RequestBody Employee employee) {
		employeeService.save(employee);
	}



}

